*** Stata 14.1 reproduction code for Mader & Schoen. 2017. Ideological voting in context: The case of Germany during the Merkel era

*** This code reproduces all results reported in Mader & Schoen (2017).

*** Run "Mader_Schoen_2017_reproduction_syntax_1.do" and "Mader_Schoen_2017_reproduction_syntax_1.do" to create data set first.

************************************************************************************************************************************
************************************************************************************************************************************

	set more off

** Define directory with data sets
	cd "C:\Users\m.mader\Google Drive\Forschung\Mader_Schoen_2017_GLES_Book\Daten"


** Open data set: Reduced and cleaned GLES Online Trackings and Media data
	use "GLES_tracking_media.dta", clear

	
***************************************************************************	
*Figure 11.2: Cross-sectional models based on GLES Online Trackings, T1-T30
***************************************************************************

*CDU/CSU
	logit v_union (c.li c.re)##i.track i.pi5 ib3.age_cat ib2.edu i.female i.ost [pweight = weight1]
	estimates store m1
	margins , dydx(li) at(track=(1 (1) 30)) post
	estimates store f2a1
	estimate restore m1
	margins , dydx(re) at(track=(1 (1) 30)) post
	estimates store f2a2
	coefplot (f2a1, msymbol(diamond) mcolor(gs0) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs0)) offset(0.00)) ///
			(f2a2, msymbol(diamond) mcolor(gs11) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs11)) offset(0.2)) ///
			 ,  scheme(s1mono) vertical yline(0, lcolor(black)) ytitle("Average marginal effects", margin(0 0 0 0)) ///
			xtitle(" ") xlabel(1 " " 2 " " 3 "T3" 4 " " 5 " " 6 "T6" /// 
				7 " " 8 " " 9 "T9" 10 " " 11 " " 12 "T12" 13 " " ///
				14 " " 15 "T15" 16 " " 17 " " 18 "T18" 19 " " 20 " " ///
				21 "T21" 22 " " 23 " " 24 "T24" 25 " " 26 " " 27 "T27" ///
				28 " " 29 " " 30 "T30" 31 " ", labsize(small) angle(0)) ///
			xline(6.5 21.5, lcolor(gs14) lpattern(dash)) text(.3 6.5 "Federal election" "2009" .3 21.5 "Federal election" "2013", color(gs10) place(e) size(vsmall))  ///
			yscale(range(-.4 .4) noline) ylabel(-.4 (.2) .4, nogrid angle(0))  ///	
			legend(order(1 "Left identity" 3 "Right identity") col(3) region(lcolor(white))) ///
			graphregion(color(white) lwidth(large) lstyle(none))  ///
			title("CDU/CSU", size(medsmall) color(black)) ///
			name(f2a, replace) xscale(off fill) legend(off)
	 window manage close graph
	 

*SPD
	logit v_spd (c.li c.re)##i.track i.pi5  ib3.age_cat ib2.edu i.female i.ost [pweight = weight1]
	estimates store m2
	margins , dydx(li) at(track=(1 (1) 30)) post
	estimates store f2b1
	estimate restore m2
	margins , dydx(re) at(track=(1 (1) 30)) post
	estimates store f2b2
	coefplot (f2b1, msymbol(diamond) mcolor(gs0) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs0)) offset(0.00)) ///
			(f2b2, msymbol(diamond) mcolor(gs11) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs11)) offset(0.2)) ///
			 , scheme(s1mono) vertical yline(0, lcolor(black)) ytitle("Average marginal effects") ///
			xtitle(" ") xlabel(1 " " 2 " " 3 "T3" 4 " " 5 " " 6 "T6" /// 
				7 " " 8 " " 9 "T9" 10 " " 11 " " 12 "T12" 13 " " ///
				14 " " 15 "T15" 16 " " 17 " " 18 "T18" 19 " " 20 " " ///
				21 "T21" 22 " " 23 " " 24 "T24" 25 " " 26 " " 27 "T27" ///
				28 " " 29 " " 30 "T30" 31 " ", labsize(small) angle(0)) ///
			xline(6.5 21.5, lcolor(gs14) lpattern(dash)) ///
			yscale(range(-.4 .4) noline) ylabel(-.4 (.2) .4, nogrid)  ///	
			legend(order(1 "Left identity" 3 "Right identity") col(3) position(6) ring(0) region(lcolor(white))) ///
			graphregion(color(white) lwidth(large) lstyle(none)) ///
			title("SPD", size(medsmall) color(black))  ///
			name(f2b, replace) xscale(off fill) yscale(off fill) legend(off)
	 window manage close graph
	 
*Green Party
	logit v_greens (c.li c.re)##i.track i.pi5  ib3.age_cat ib2.edu i.female i.ost [pweight = weight1]
	estimates store m3
	margins , dydx(li) at(track=(1 (1) 30)) post
	estimates store f2c1
	estimate restore m3
	margins , dydx(re) at(track=(1 (1) 30)) post
	estimates store f2c2
	coefplot (f2c1, msymbol(diamond) mcolor(gs0) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs0)) offset(0.00)) ///
			(f2c2, msymbol(diamond) mcolor(gs11) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs11)) offset(0.2)) ///
			 , scheme(s1mono) vertical yline(0, lcolor(black)) ytitle("Average marginal effects", margin(0 0 0 0)) ///
			xtitle(" ") xlabel(1 " " 2 "T2" 3 " " 4 "T4" 5 " " 6 "T6" /// 
				7 " " 8 "T8" 9 " " 10 "T10" 11 " " 12 "T12" 13 " " ///
				14 "T14" 15 " " 16 "T16" 17 " " 18 "T18" 19 " " 20 "T20" ///
				21 " " 22 "T22" 23 " " 24 "T24" 25 " " 26 "T26" 27 " " ///
				28 "T28" 29 " " 30 "T30" 31 " ", labsize(small) angle(45)) ///
			xline(6.5 21.5, lcolor(gs14) lpattern(dash))  xscale(noline) ///
			yscale(range(-.4 .4)) ylabel(-.4 (.2) .4, nogrid angle(0))  ///	
			legend(order(1 "Left identity" 3 "Right identity") col(3) position(6) ring(0) region(lcolor(white))) ///
			graphregion(color(white) lwidth(large) lstyle(none)) ///
			title("Green Party", size(medsmall) color(black)) ///
			name(f2c, replace) legend(off)
	 window manage close graph
	 
*Left Party
	logit v_left (c.li c.re)##i.track i.pi5 ib3.age_cat ib2.edu i.female i.ost [pweight = weight1]
	estimates store m4
	margins , dydx(li) at(track=(1 (1) 30)) post
	estimates store f2d1
	estimate restore m4
	margins , dydx(re) at(track=(1 (1) 30)) post
	estimates store f2d2
	coefplot (f2d1, msymbol(diamond) mcolor(gs0) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs0)) offset(0.00)) ///
			(f2d2, msymbol(diamond) mcolor(gs11) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs11)) offset(0.2)) ///
			 , scheme(s1mono) vertical yline(0, lcolor(black)) ytitle(Average marginal effects) ///
			xtitle(" ") xlabel(1 " " 2 "T2" 3 " " 4 "T4" 5 " " 6 "T6" /// 
				7 " " 8 "T8" 9 " " 10 "T10" 11 " " 12 "T12" 13 " " ///
				14 "T14" 15 " " 16 "T16" 17 " " 18 "T18" 19 " " 20 "T20" ///
				21 " " 22 "T22" 23 " " 24 "T24" 25 " " 26 "T26" 27 " " ///
				28 "T28" 29 " " 30 "T30" 31 " ", labsize(small) angle(45)) ///
			xline(6.5 21.5, lcolor(gs14) lpattern(dash)) xscale(noline) ///
			yscale(range(-.4 .4)) ylabel(-.4 (.2) .4, nogrid)  ///	
			legend(order(1 "Left identity" 3 "Right identity") col(3) position(6) ring(0) region(lcolor(white))) ///
			graphregion(color(white) lwidth(large) lstyle(none)) ///
			title("Left Party", size(medsmall) color(black)) ///
			name(f2d, replace) yscale(off fill)
	 window manage close graph
	 
	graph combine f2a f2b f2c f2d, name(figure2, replace) ycommon xcommon commonscheme  scheme(s1mono) graphregion(color(white) lwidth(vlarge)) title("", color(gs0)) plotregion(lpattern(blank))  
	
	
*********************************************************************************************************
*Figure 11.3: Ideological voting for the CDU/CSU among the politically involved and uninvolved, 2009-2015
*********************************************************************************************************

*CDU/CSU

	logit v_union (c.li c.re)##i.track##i.polint_d i.pi5 ib3.age_cat ib2.edu i.female i.ost if help0 == 0 [pweight = weight1]
	estimates store m1
	margins , dydx(li) at(track=(1 2 3 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30) polint_d=(1)) post
	estimates store f3a1
	
	estimates restore m1
	margins , dydx(li)at(track=(1 2 3 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30) polint_d=(0)) post
	estimates store f3a2	
	
	coefplot (f3a1, msymbol(diamond) mcolor(gs0) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs0)) offset(0.00)) ///
			(f3a2, msymbol(diamond) mcolor(gs11) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs11)) offset(0.2)) ///
			 , scheme(s1mono) vertical yline(0, lcolor(black)) ytitle("Average marginal effects", margin(0 -10 0 0)) ///
			order(1._at 2._at 3._at . 4._at 5._at 6._at 7._at 8._at 9._at 10._at 11._at 12._at 13._at 14._at 15._at 16._at 17._at 18._at 19._at 20._at 21._at 22._at 23._at 24._at 25._at 26_at 27._at) ///
			xtitle(" ") xlabel(,labcolor(gs16) noticks)  ///
			xline(6.5 21.5, lcolor(gs14) lpattern(dash)) text(.3 6.5 "Federal election" "2009" .4 21.5 "Federal election" "2013", place(e) size(vsmall)) xscale(noline) ///
			yscale(range(-.7 .4)) ylabel(-.6 (.2) .4, nogrid angle(0))  ///	
			legend(order(1 "High involvement" 3 "Low involvement") col(3) region(lcolor(white))) ///
			graphregion(color(white) lwidth(large) lstyle(none))  ///
			title("Left identity", size(medsmall) color(black)) ///
			name(f3a, replace) legend(off) graphregion(color(white))
	 window manage close graph

			
	logit v_union (c.li c.re)##i.track##i.polint_d i.pi5 ib3.age_cat ib2.edu i.female i.ost [pweight = weight1]
	estimate store m2	 
	margins , dydx(re) at(track=(1 (1) 30) polint_d=(1)) post
	estimates store f3b1
	estimate restore m2
	margins , dydx(re) at(track=(1 (1) 30) polint_d=(0)) post
	estimates store f3b2
	
	coefplot (f3b1, msymbol(diamond) mcolor(gs0) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs0)) offset(0.00)) ///
			(f3b2, msymbol(diamond) mcolor(gs11) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs11)) offset(0.2)) ///
			 , scheme(s1mono) vertical yline(0, lcolor(black)) ytitle("Average marginal effects", margin(0 -10 0 0)) ///
			xtitle(" ") xlabel(1 " " 2 "T2" 3 " " 4 "T4" 5 " " 6 "T6" /// 
				7 " " 8 "T8" 9 " " 10 "T10" 11 " " 12 "T12" 13 " " ///
				14 "T14" 15 " " 16 "T16" 17 " " 18 "T18" 19 " " 20 "T20" ///
				21 " " 22 "T22" 23 " " 24 "T24" 25 " " 26 "T26" 27 " " ///
				28 "T28" 29 " " 30 "T30" 31 " ", labsize(med) angle(forty_five)) ///
			xline(6.5 21.5, lcolor(gs14) lpattern(dash)) xscale(noline) ///
			yscale(range(-.7 .4) noline) ylabel(-.6 (.2) .4, nogrid angle(0))  ///	
			legend(order(1 "High involvement" 3 "Low involvement") col(3) position(5) ring(0) region(lcolor(white))) ///
			graphregion(color(white) lwidth(large) lstyle(none))  ///
			title("Right identity", size(medsmall) color(black)) ///
			name(f3b, replace) graphregion(color(white)) 
	window manage close graph
	 
	graph combine f3a f3b, name(figure3, replace) rows(2) xcommon commonscheme scheme(s1mono) graphregion(color(white) lwidth(vlarge)) title("") plotregion(lpattern(blank))  imargins (0 0 0 0)

	
******************************************************************
*Table 11.1: Multi-level models for CDU/CSU vote choice, 2009-2015
******************************************************************
	
*The young
	*Random intercept and slopes (Is there slope variance?)
		meqrlogit v_union wcm_lire ib0.pi5 ib2.edu i.female i.ost  || track830: wcm_lire if above50==0, cov(unstructured)
		estimates store v_union_1_rirs	
		estat ic
		estat icc		
	*Cross level interaction: Absolute salience of retirement and health issues
		meqrlogit v_union c.wcm_lire##c.c_retirementhealth_perc2 ib0.pi5 ib2.edu i.female i.ost  || track830: c.wcm_lire if above50==0 , cov(unstructured)
		estimates store v_union_1_retirementhealth
		estat ic
		estat icc
	
*The older	
	*Random intercept and slopes (Is there slope variance?)
		meqrlogit v_union wcm_lire ib0.pi5 ib2.edu i.female i.ost  || track830: wcm_lire   if above50 == 1 , cov(unstructured)
		estimates store v_union_2_rirs	
		estat ic
		estat icc		
	*Cross level interaction: Absolute salience of retirement and health issues
		meqrlogit v_union c.wcm_lire##c.c_retirementhealth_perc2 ib0.pi5 ib2.edu i.female i.ost  || track830: c.wcm_lire if above50==1 , cov(unstructured)
		estimates store v_union_2_retirementhealth
		estat ic
		estat icc
	
***************************************************************************************************************************************************************************************
*Figure 11.4: Predicted effects of ideological identities on voting intentions for the CDU/CSU depending on the salience of health and retirement issues (young and elderly population)
***************************************************************************************************************************************************************************************

	*range of values of c_retirementhealth_perc:
	sum c_retirementhealth_perc2
	
	*    Variable |        Obs        Mean    Std. Dev.       Min        Max
	*-------------+---------------------------------------------------------
	*c_retireme~2 |     24,687    .0009547    1.382826  -2.316112   3.304362

	estimates restore v_union_1_retirementhealth					
	margins , dydx(wcm_lire) at(c_retirementhealth_perc2=(-2.316112 (0.5109521818181818) 3.304362)) predict(mu fixedonly) vsquish post
	estimates store young

	estimates restore v_union_2_retirementhealth	
	margins , dydx(wcm_lire) at(c_retirementhealth_perc2=(-2.316112 (0.5109521818181818) 3.304362)) predict(mu fixedonly) vsquish post
	estimates store elderly
		
	coefplot (young, msymbol(diamond) mcolor(gs0) msize(med) ciopts(recast(rbar) barwidth(0.05) color(gs0)) offset(0.00)) ///
		(elderly, msymbol(diamond) mcolor(gs11) msize(med) ciopts(recast(rbar) barwidth(0.05) color(gs11)) offset(0.2)) ///
		, name(figure4, replace) vertical yline(0, lcolor(black)) title("") ///
		xtitle("Salience of retirement and health issues") xlabel(1 "Low" 6.5 "Medium" 12 "High") xscale(noline) ///
		ytitle("Average marginal effect") yscale (range(-.1 .3)) ylabel(-.1 (.1) .3, nogrid angle(0) labsize(medsmall))  ///				
		legend(order(1 "Elderly" 3 "Young") col(3) position(2) ring(0) region(lcolor(white))) ///
		graphregion(color(white)) scheme(s1mono)

	

****************************************************************************************************************
*Appendix, Figure 11.5: Media salience of health and retirement issues and partisan actors in Germany, 2009-2015
****************************************************************************************************************

	graph bar retirementhealth_perc2, name(figureA1a, replace) over(track830, label(angle(45)))   ytitle("Percent of articles") yscale(range(0 10)) ylabel(0 (2) 10, angle(0) nogrid) scheme(s2mono) ///
		graphregion(color(white)) bgcolor(white)  title("Retirement and health issues")

	graph bar left_act_perc2, name(figureA1b, replace) over(track830, label(angle(45)))   ytitle("Percent of articles") yscale(range(0 15)) ylabel(0 (5) 30, angle(0) nogrid) scheme(s2mono) ///
		graphregion(color(white)) bgcolor(white)  title("Left partisan actors")
	
	graph bar right_act_perc2, name(figureA1c, replace) over(track830, label(angle(45)))   ytitle("Percent of articles") yscale(range(0 15)) ylabel(0 (5) 30, angle(0) nogrid) scheme(s2mono) ///
		graphregion(color(white)) bgcolor(white)  title("Right partisan actors")
	
	
**************************************************************************************************************************************
*Additional results (referred to in the text): Ideological voting for the SPD among the politically involved and uninvolved, 2009-2015
**************************************************************************************************************************************

*SPD
	logit v_spd (c.li c.re)##i.track##i.polint_d i.pi5 ib3.age_cat ib2.edu i.female i.ost [pweight = weight1]
	estimates store spd1
	margins , dydx(li) at(track=(1 (1) 30) polint_d=(1)) post	
	estimates store marg1a
	estimates restore spd1
	margins , dydx(li) at(track=(1 (1) 30) polint_d=(0)) post
	estimates store marg1b	
	
	coefplot (marg1a, msymbol(diamond) mcolor(gs0) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs0)) offset(0.00)) ///
			(marg1b, msymbol(diamond) mcolor(gs11) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs11)) offset(0.2)) ///
			 , scheme(s1mono) vertical yline(0, lcolor(black)) ytitle("Average marginal effects", margin(0 -10 0 0)) ///
			xtitle("") xlabel(, labcolor(gs16) noticks) xscale(noline)  ///
			xline(6.5 21.5, lcolor(gs14) lpattern(dash)) text(.3 6.5 "Federal election" "2009" .3 21.5 "Federal election" "2013", place(e) size(vsmall)) ///
			yscale(range(-.8 .4)) ylabel(-.6 (.2) .4, nogrid angle(0))  ///	
			legend(order(1 "High involvement" 3 "Low involvement") col(3) region(lcolor(white))) ///
			graphregion(color(white) lwidth(large) lstyle(none))  ///
			title("Left identity", size(medsmall) color(black)) ///
			name(A2a, replace) legend(off) graphregion(color(white))
	 window manage close graph

			
	logit v_spd (c.li c.re)##i.track##i.polint_d i.pi5 ib3.age_cat ib2.edu i.female i.ost if help1 == 0 [pweight = weight1]
	estimate store spd2	 
	margins , dydx(re) at(track=(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 29 30) polint_d=(1)) post
	estimates store marg2a

	estimate restore spd2
	margins , dydx(re) at(track=(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 29 30) polint_d=(0)) post
	estimates store marg2b
	
	coefplot (marg2a, msymbol(diamond) mcolor(gs0) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs0)) offset(0.00)) ///
			(marg2b, msymbol(diamond) mcolor(gs11) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs11)) offset(0.2)) ///
			 , scheme(s1mono) vertical yline(0, lcolor(black)) ytitle("Average marginal effects", margin(0 -10 0 0)) ///
			order(1._at 2._at 3._at 4._at 5._at 6._at 7._at 8._at 9._at 10._at 11._at 12._at 13._at 14._at 15._at 16._at 17._at 18._at 19._at 20._at 21._at 22._at 23._at 24._at 25._at 26._at . . 27._at 28._at) ///
			xtitle("") xlabel(1 " " 2 "T2" 3 " " 4 "T4" 5 " " 6 "T6" /// 
				7 " " 8 "T8" 9 " " 10 "T10" 11 " " 12 "T12" 13 " " ///
				14 "T14" 15 " " 16 "T16" 17 " " 18 "T18" 19 " " 20 "T20" ///
				21 " " 22 "T22" 23 " " 24 "T24" 25 " " 26 "T26" 27 " " ///
				28 "T28" 29 " " 30 "T30" 31 " ", labsize(small) angle(forty_five)) ///
			xline(6.5 21.5, lcolor(gs14) lpattern(dash)) xscale(noline) ///
			yscale(range(-.8 .4) noline) ylabel(-.6 (.2) .4, nogrid angle(0))  ///	
			legend(order(1 "High involvement" 3 "Low involvement") col(3) position(5) ring(0) region(lcolor(white))) ///
			graphregion(color(white) lwidth(large) lstyle(none))  ///
			title("Right identity", size(medsmall) color(black)) ///
			name(A2b, replace) graphregion(color(white)) 
	 window manage close graph
	 
	graph combine A2a A2b, name(figureA2, replace) rows(2) xcommon commonscheme  scheme(s1mono) graphregion(color(white) lwidth(vlarge)) title("") plotregion(lpattern(blank))  imargins (0 0 0 0)
	
	
***********************************************************************************************************************************************
*Additional results (referred to in the text):  Ideological voting for the Green Party among the politically involved and uninvolved, 2009-2015
***********************************************************************************************************************************************

	logit v_greens (c.li c.re)##i.track##i.polint_d i.pi5 ib3.age_cat ib2.edu i.female i.ost if help2 == 0 [pweight = weight1]
	estimates store green1
	margins , dydx(li) at(track=(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 26 27 28 29 30) polint_d=(1)) post
	estimates store green11
	
	estimates restore green1
	margins , dydx(li)at(track=(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 26 27 28 29 30) polint_d=(0)) post
	estimates store green12	
	
	coefplot (green11, msymbol(diamond) mcolor(gs0) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs0)) offset(0.00)) ///
			(green12, msymbol(diamond) mcolor(gs11) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs11)) offset(0.2)) ///
			 , scheme(s1mono) vertical yline(0, lcolor(black)) ytitle("Average marginal effects", margin(0 -10 0 0)) ///
			order(1._at 2._at 3._at 4._at 5._at 6._at 7._at 8._at 9._at 10._at 11._at 12._at 13._at 14._at 15._at 16._at 17._at 18._at 19._at 20._at 21._at 22._at 23._at 24._at . 25._at 26._at 27._at 28._at 29._at) ///
			xtitle("") xlabel(, labcolor(gs16) noticks) xscale(noline)  ///
			xline(6.5 21.5, lcolor(gs14) lpattern(dash)) text(.3 6.5 "Federal election" "2009" .3 21.5 "Federal election" "2013", place(e) size(vsmall)) ///
			yscale(range(-.8 .4)) ylabel(-.6 (.2) .4, nogrid angle(0))  ///	
			legend(order(1 "High involvement" 3 "Low involvement") col(3) region(lcolor(white))) ///
			graphregion(color(white) lwidth(large) lstyle(none))  ///
			title("Left identity", size(medsmall) color(black)) ///
			name(A3a, replace) legend(off) graphregion(color(white))
	 window manage close graph

			
	logit v_green (c.li c.re)##i.track##i.polint_d i.pi5 ib3.age_cat ib2.edu i.female i.ost if help3 == 0 [pweight = weight1]
	estimate store green2	 
	margins , dydx(re) at(track=(1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 27 28 29 30) polint_d=(1)) post
	estimates store green21
	
	estimate restore green2
	margins , dydx(re) at(track=(1 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 27 28 29 30) polint_d=(0)) post
	estimates store green22
	
	coefplot (green21, msymbol(diamond) mcolor(gs0) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs0)) offset(0.00)) ///
			(green22, msymbol(diamond) mcolor(gs11) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs11)) offset(0.2)) ///
			 , scheme(s1mono) vertical yline(0, lcolor(black)) ytitle("Average marginal effects", margin(0 -10 0 0)) ///
			order(1._at . 2._at 3._at 4._at 5._at 6._at 7._at 8._at 9._at 10._at 11._at 12._at 13._at 14._at 15._at 16._at 17._at 18._at 19._at 20._at 21._at 22._at 23._at 24._at 25._at . 26._at 27._at) ///
			xtitle("") xlabel(1 " " 2 "T2" 3 " " 4 "T4" 5 " " 6 "T6" /// 
				7 " " 8 "T8" 9 " " 10 "T10" 11 " " 12 "T12" 13 " " ///
				14 "T14" 15 " " 16 "T16" 17 " " 18 "T18" 19 " " 20 "T20" ///
				21 " " 22 "T22" 23 " " 24 "T24" 25 " " 26 "T26" 27 " " ///
				28 "T28" 29 " " 30 "T30" 31 " ", labsize(small) angle(forty_five)) ///
			xline(6.5 21.5, lcolor(gs14) lpattern(dash)) xscale(noline) ///
			yscale(range(-.6 .4)) ylabel(-.6 (.2) .4, nogrid angle(0))  ///	
			legend(order(1 "High involvement" 3 "Low involvement") col(3) position(5) ring(0) region(lcolor(white))) ///
			graphregion(color(white) lwidth(large) lstyle(none))  ///
			title("Right identity", size(medsmall) color(black)) ///
			name(A3b, replace) graphregion(color(white)) 
	 window manage close graph
	 
	graph combine A3a A3b, name(figureA3, replace) scheme(s1mono) rows(2) xcommon commonscheme graphregion(color(white) lwidth(vlarge)) title("") plotregion(lpattern(blank))  imargins (0 0 0 0)
	

******************************************************************************************************************************
*Additional results (referred to in the text):  Ideological voting for the Left Party among the politically involved and uninvolved, 2009-2015
******************************************************************************************************************************

	logit v_left (c.li c.re)##i.track##i.polint_d i.pi5 ib3.age_cat ib2.edu i.female i.ost if help4 == 0 [pweight = weight1]
	estimates store left1
	margins , dydx(li) at(track=(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16   19  21  23  25 26 27 28 29 30) polint_d=(1)) post
	estimates store left11
	
	estimates restore left1
	margins , dydx(li)at (track=(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16   19  21  23  25 26 27 28 29 30) polint_d=(0)) post
	estimates store left12	
	
	coefplot (left11, msymbol(diamond) mcolor(gs0) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs0)) offset(0.00)) ///
			(left12, msymbol(diamond) mcolor(gs11) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs11)) offset(0.2)) ///
			 , scheme(s1mono) vertical yline(0, lcolor(black)) ytitle("Average marginal effects", margin(0 -10 0 0)) ///
			order(1._at 2._at 3._at 4._at 5._at 6._at 7._at 8._at 9._at 10._at 11._at 12._at 13._at 14._at 15._at 16._at . . 17._at . 18._at . 19._at . 20._at 21._at 22._at 23._at 24._at  25._at) ///
			xtitle("") xlabel(, labcolor(gs16) noticks) xscale(noline)  ///
			xline(6.5 21.5, lcolor(gs14) lpattern(dash)) text(.4 6.5 "Federal election" "2009" .4 21.5 "Federal election" "2013", place(e) size(vsmall)) ///
			yscale(range(-.7 .4)) ylabel(-.6 (.2) .4, nogrid angle(0))  ///	
			legend(order(1 "High involvement" 3 "Low involvement") col(3) region(lcolor(white))) ///
			graphregion(color(white) lwidth(large) lstyle(none))  ///
			title("Left identity", size(medsmall) color(black)) ///
			name(A4a, replace) legend(off) graphregion(color(white))
	 window manage close graph

			
	estimates restore left1	 
	margins , dydx(re) at(track=(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 19 21 23 25 26 27 28 29 30) polint_d=(1)) post
	estimates store left21
	estimates restore left1
	margins , dydx(re)at (track=(1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 19 21 23 25 26 27 28 29 30) polint_d=(0)) post
	estimates store left22
	
	coefplot (left21, msymbol(diamond) mcolor(gs0) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs0)) offset(0.00)) ///
			(left22, msymbol(diamond) mcolor(gs11) msize(small) ciopts(recast(rbar) barwidth(0.1) color(gs11)) offset(0.2)) ///
			 , scheme(s1mono) vertical yline(0, lcolor(black)) ytitle("Average marginal effects", margin(0 -10 0 0)) ///
			order(1._at 2._at 3._at 4._at 5._at 6._at 7._at 8._at 9._at 10._at 11._at 12._at 13._at 14._at 15._at 16._at . . 17._at . 18._at . 19._at . 20._at 21._at 22._at 23._at) ///
			xtitle("") xlabel(1 " " 2 "T2" 3 " " 4 "T4" 5 " " 6 "T6" /// 
				7 " " 8 "T8" 9 " " 10 "T10" 11 " " 12 "T12" 13 " " ///
				14 "T14" 15 " " 16 "T16" 17 " " 18 "T18" 19 " " 20 "T20" ///
				21 " " 22 "T22" 23 " " 24 "T24" 25 " " 26 "T26" 27 " " ///
				28 "T28" 29 " " 30 "T30" 31 " ", labsize(small) angle(forty_five)) xscale(noline)  ///
			xline(6.5 21.5, lcolor(gs14) lpattern(dash)) xscale(noline) ///
			yscale(range(-.7 .4)) ylabel(-.6 (.2) .4, nogrid angle(0))  ///	
			legend(order(1 "High involvement" 3 "Low involvement") col(3) position(5) ring(0) region(lcolor(white))) ///
			graphregion(color(white) lwidth(large) lstyle(none))  ///
			title("Right identity", size(medsmall) color(black)) ///
			name(A4b, replace) graphregion(color(white)) 
	 window manage close graph
	 
	graph combine A4a A4b, name(figureA4, replace) scheme(s1mono) rows(2) xcommon commonscheme graphregion(color(white) lwidth(vlarge)) title("") plotregion(lpattern(blank))  imargins (0 0 0 0)

	
	
***************************************************************************************************************************************************
*Additional results (referred to in the text): Predicted effects of ideological identities on voting intentions for the [SPD / Green Party / Left Party
*											   depending on the salience of health and retirement issues (young and elderly population)
***************************************************************************************************************************************************

foreach var in v_spd v_greens v_left {

*The young	
	*Random intercept and slopes (Is there slope variance?)
	meqrlogit `var' wcm_lire  ib0.pi5 ib2.edu i.female i.ost  || track: wcm_lire if above50==0 , cov(unstructured)
	estimates store `var'_2_rirs	
	estat ic
	estat icc		
*Cross level interaction: Absolute salience of retirement and health issues
	meqrlogit `var' c.wcm_lire##c.c_retirementhealth_perc2 ib0.pi5 ib2.edu i.female i.ost  || track: wcm_lire if above50==0 , cov(unstructured)
	estimates store `var'_2_retirementhealth
	estat ic
	estat icc
	
*The elderly
	*Random intercept and slopes (Is there slope variance?)
	meqrlogit `var' wcm_lire  ib0.pi5 ib2.edu i.female i.ost  || track: wcm_lire if above50==1 , cov(unstructured)
	estimates store `var'_1_rirs	
	estat ic
	estat icc		
*Cross level interaction: Absolute salience of retirement and health issues
	meqrlogit `var' c.wcm_lire##c.c_retirementhealth_perc2 ib0.pi5 ib2.edu i.female i.ost  || track: wcm_lire if above50==1 , cov(unstructured)
	estimates store `var'_1_retirementhealth
	estat ic
	estat icc
		
estimates restore `var'_1_retirementhealth					
	margins , dydx(wcm_lire) at(c_retirementhealth_perc2=(-2.316112 (0.5109521818181818) 3.304362)) predict(mu fixedonly) vsquish post
	estimates store elderly

	estimates restore `var'_2_retirementhealth	
	margins , dydx(wcm_lire) at(c_retirementhealth_perc2=(-2.316112 (0.5109521818181818) 3.304362)) predict(mu fixedonly) vsquish post
	estimates store young
		
	coefplot (elderly, msymbol(diamond) mcolor(gs0) msize(med) ciopts(recast(rbar) barwidth(0.05) color(gs0)) offset(0.00)) ///
		(young, msymbol(diamond) mcolor(gs11) msize(med) ciopts(recast(rbar) barwidth(0.05) color(gs11)) offset(0.2)) ///
		, vertical yline(0, lcolor(black)) title("") ///
		xtitle("Salience of retirement and health issues") xlabel(1 "Low" 6.5 "Medium" 12 "High") xscale(noline) ///
		ytitle("Average marginal effect", margin(0 -10 0 0)) yscale (range(-.3 .3)) ylabel(-.3 (.1) .3, nogrid angle(0) labsize(medsmall))  ///				
		legend(order(1 "Elderly" 3 "Young") col(3) position(2) ring(0) region(lcolor(white))) ///
		title(`var') graphregion(color(white)) scheme(s1mono) name(`var'_cli, replace)
}
